package com.hcf.admin.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hcf.admin.common.convention.result.Result;
import com.hcf.admin.common.convention.result.ResultTool;
import com.hcf.admin.remote.ShortLinkProjectService;
import com.hcf.admin.remote.dto.req.ShortLinkCreateReqDTO;
import com.hcf.admin.remote.dto.req.ShortLinkPageReqDTO;
import com.hcf.admin.remote.dto.req.ShortLinkUpdateReqDto;
import com.hcf.admin.remote.dto.resp.ShortLinkCreateRespDTO;
import com.hcf.admin.remote.dto.resp.ShortLinkPageRespDTO;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/shortlink/admin/v1")
public class ShortLinkController {

    ShortLinkProjectService shortLinkProjectService = new ShortLinkProjectService(){};

    @GetMapping("/page")
    public Result<IPage<ShortLinkPageRespDTO>> pageShortLink(@RequestBody ShortLinkPageReqDTO requestParam) {
        return shortLinkProjectService.pageShortLink(requestParam);
    }

    @PostMapping("/create")
    public Result<ShortLinkCreateRespDTO> createShortLink(@RequestBody ShortLinkCreateReqDTO requestParam) {
        return shortLinkProjectService.createShortLink(requestParam);
    }

    @PutMapping("/update")
    public Result<Void> updateShortLink(@RequestBody ShortLinkUpdateReqDto requestParam) {
        shortLinkProjectService.updateShortLink(requestParam);
        return ResultTool.success();
    }



}
